# build_time
# 构建时间信息（字符串）
def build_event_time(time_dict):
    try:
        # 检查并获取四个必要字段
        year = time_dict.get('year')
        month = time_dict.get('month')
        day = time_dict.get('day')
        hour = time_dict.get('hour')

        # 确保所有值都不是 None 或空值
        if None in (year, month, day, hour):
            return '未知'

        # 格式化为 "YYYY-MM-DD HH:00"
        return f"{year:04d}-{month:02d}-{day:02d} {hour:02d}:00"

    except (KeyError, TypeError, ValueError):
        # 任何错误（如缺少键、类型错误、转换失败等）都返回未知
        return '未知'

def build_time_header(time_dict:dict)->str:
    dt = time_dict.get("current_time",None)
    ganzhi = time_dict.get("time_info",None)
    next_equinox = time_dict.get("next_time",None)
    return f'公历日期：{dt}\n干支时间：{ganzhi}\n未来节气：{next_equinox}'